Skip to content
Qt 6.12 LTS is out! See what's new in the release blog
  • Dynamically Construct Path and PathLines

    Unsolved QML and Qt Quick path pathline
    4
    0 Votes
    4 Posts
    1k Views
    D
    I have the Path and PathLine working with the above initial declaration of Path and Pathline. What I've been trying to do is either user a timer OnTriggered to create the Path and append/push... pathElements, or, use a Repeater to create the path. Variations on things I've tried below. a) Timer OnTriggered, var pathLine = Qt.createQmlObject('import QtQuick 1.1;PathLine {x:0; y:0}',_myPath) if(_myPath.pathElements.length == 0) { for(var j=0;j<24;j++) { _myPath.pathElements.push({"x":j,"y":0}) } } b) Repeater, Repeater{ id: repeater model: myModel delegate: Item{ property ShapePath s: ShapePath{ strokeWidth: 2 PathLine{x: model.x; y: model.y} } Component.onCompleted: { shape.data.push(s) } } } } My line chart is 48 segments and is fine for what I'm trying to do. The code is not very elegant, but works. Thanks